{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $do == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('newsclassify')}">管理</a></li>
	<li {if $do == 'post' && empty($id)}class="active"{/if}><a href="{php echo $this->createWebUrl('newsclassify', array('act' => 'post'))}">添加</a></li>
</ul>
{if $do == 'post'}

<style>
	.template .item{position:relative;display:block;float:left;border:1px #ddd solid;border-radius:5px;background-color:#fff;padding:5px;width:190px;margin:0 20px 20px 0; overflow:hidden;}
	.template .title{margin:5px auto;line-height:2em;}
	.template .title a{text-decoration:none;}
	.template .item img{width:178px;height:270px; cursor:pointer;}
	.template .active.item-style img, .template .item-style:hover img{width:178px;height:270px;border:3px #009cd6 solid;padding:1px; }
	.template .title .fa{display:none}
	.template .active .fa.fa-check{display:inline-block;position:absolute;bottom:33px;right:6px;color:#FFF;background:#009CD6;padding:5px;font-size:14px;border-radius:0 0 6px 0;}
	.template .fa.fa-times{cursor:pointer;display:inline-block;position:absolute;top:10px;right:6px;color:#D9534F;background:#ffffff;padding:5px;font-size:14px;text-decoration:none;}
	.template .fa.fa-times:hover{color:red;}
	.template .item-bg{width:100%; height:342px; background:#000; position:absolute; z-index:1; opacity:0.5; margin:-5px 0 0 -5px;}
	.template .item-build-div1{position:absolute; z-index:2; margin:-5px 10px 0 5px; width:168px;}
	.template .item-build-div2{text-align:center; line-height:30px; padding-top:150px;}
</style>

<div class="main">
<?php if($edit){$func = 'edit';}else{$func = 'add';} ?>
<form action="{php echo $this->createWebUrl('newsclassify', array('act' => $func,'class_id' => $class_id))}" method="post" class="form-horizontal form" id="form1">
    <div class="panel panel-default">
			<div class="panel-heading">分类详细设置</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">分类名称</label>
					<div class="col-sm-8 col-xs-12">
						<input type="text" name="classname" class="form-control" value={$classname} >
					</div>
				</div>
			</div>
		</div>

	<div class="form-group">
		<div class="col-sm-12">
			<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
		</div>
	</div>
	</form>
</div>
<script type="text/javascript">
<!--
	$("#form1").submit(function(){
		if($("input[name='cname']").val() == '') {
			util.message('请输入分类名称', '', 'error');
			return false;
		}
	});

	$('.change-style').click(function() {
		var styleId = parseInt($(this).data('styleid'));
		var title = $('.title-' + styleId).text();
		var preview = $('.preview-' + styleId).attr('src');
		$('.item-style').removeClass('active');
		$('#styleid').val(styleId);
		$('#current-title').text(title);
		$('#current-preview').attr('src', preview);
		$(this).parent().parent().addClass('active');
		$('#ListStyle').modal('hide');
	});

//-->
</script>
{elseif $do == 'display'}
<div class="main">
	<div class="category">
		<form action="" method="post" onsubmit="return formcheck(this)">
		<div class="panel panel-default">
		<div class="panel-body table-responsive">
		<table class="table table-hover">
			<thead>
				<tr>
					<th style="width:5%; text-align:center;">序号</th>
					<th style="width:80%;text-align:left;">分类名称</th>
					<th style="width:15%; text-align:center">操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $category $row}
				<tr>
					<td class="text-center">
						{$row['class_id']}
					</td>
					<td class="text-left"><div style="height:30px;line-height:30px">{$row['classname']}</div></td>
					<td class="text-center" style="position:relative;">
						<a href="{php echo $this->createWebUrl('news', array('act' => 'post','class_id' => $row['class_id'],'classname' => $row['classname']))}" title="添加贡品">添加</a>&nbsp;-&nbsp;
						<a href="{php echo $this->createWebUrl('newsclassify', array('act' => 'post','class_id' => $row['class_id'],'classname'=>$row['classname']))}" title="编辑">编辑</a>
                        <a href="{php echo $this->createWebUrl('newsclassify', array('act' => 'delete','class_id' => $row['class_id']))}" onclick="return confirm('确认删除此分类吗？');return false;" title="删除">删除</a>
                    </td>
				</tr>
			{/loop}
				<tr>
					<td colspan="4">
						<a href="{php echo $this->createWebUrl('newsclassify', array('act' => 'post'))}"><i class="fa fa-plus-circle" title="添加新分类"></i> 添加新分类</a>
					</td>
				</tr>
			</tbody>
		</table>
		</div>
		</div>
		</form>
	</div>
</div>
{/if}
{template 'common/footer'}
